﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NS.Model.Systems;
using NS.Utilities;
using NS.BLL.Systems;

public partial class Dictionary_DictionaryModify : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["ID"].ToString() != "0")
            {
                BindData();
            }
        }
    }

    //绑定数据源
    private void BindData()
    {
        Dictionary Model = DictionaryService.GetDictionaryById(int.Parse(Request.QueryString["ID"]));
        txtDicType.Text = Model.DicType;
        txtDicName.Text = Model.DicName;
        txtDicValue.Text = Model.DicValue;
        txtPaiXu.Text = Model.PaiXu.ToString();
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (UtilityService.UpdateFieldByPK("Dictionary", "DicType,DicName,DicValue,PaiXu", new Object[] { txtDicType.Text, txtDicName.Text.Trim(), txtDicValue.Text, txtPaiXu.Text.Trim() }, "ID", Request.QueryString["ID"]) > 0)
        {
           MessageBox.AppendScript(this, "$(':input[id$=\"btnBindData\"]', window.parent.document.body).click();");
        }
    }
}